import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('@/layout/Layout.vue'),
      children: [
        {
          path: '', // 默认为首页
          name: 'home',
          component: () => import('@/views/HomeView.vue')
        },
        {
          path: 'works',
          name: 'works',
          component: () => import('@/views/WorksView.vue')
        },
        {
          path: 'works/:id', // 作品详情三级路由
          name: 'work-detail',
          component: () => import('@/views/WorkDetailView.vue'),
        },
        {
          path: 'blog',
          name: 'blog',
          component: () => import('@/views/BlogView.vue')
        },
        {
          path: 'contact',
          name: 'contact',
          component: () => import('@/views/ContactView.vue')
        }
      ]
    }
  ],
})

export default router
